{/*左侧菜单开始*/}
{if condition=" $box_is_pjax != 1 "}
<aside class="main-sidebar">
  <section class="sidebar">
    <ul class="sidebar-menu">
      <li class="header">菜单</li>
      {volist name="treeMenu" id="oo"}
      {if condition=" $oo.level eq '1' && $oo.name eq 'Index/index' "}
      <li data-title="{$oo.title}" class="menu"><a href="{:url(MODULE_NAME.'/'.$oo.name)}"><i
          class="{$oo.icon}"></i><span>{$oo.title}</span></a></li>
      {elseif condition=" $oo.level eq '1' "/}
      <li class="treeview">
        <a href="javascript:void(0);">
          <i class="{$oo.icon}"></i><span>{$oo.title}</span>
          <span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>
        </a>
        <ul class="treeview-menu">
          {volist name="treeMenu" id="to"}
          {if condition=" $to.pid eq $oo.id "}
          <li data-title="{$to.title}" class="menu"><a href="{:url(MODULE_NAME.'/'.$to.name)}">{$to.title}</a></li>
          {/if}
          {/volist}
        </ul>
      </li>
      {/if}
      {/volist}
    </ul>
  </section>
</aside>
<style>
  .activeMenu {
    background: #00c0dc;
  }

  .activeMenu > a {
    background: #00c0dc !important;
    color: #fff !important;
    box-shadow: none !important;
  }
</style>
<script type="text/javascript">
    $(function () {
        var storage = window.localStorage;
        $(".menu").filter(function (index) {
            if ($(this).attr('data-title') === storage.getItem('menu')) {
                if ($(this).attr('data-title') !== '后台首页') {
                    $(this).parent().prev().trigger('click')
                }
            }
            return $(this).attr('data-title') === storage.getItem('menu')
        }).addClass('activeMenu')
        $('.menu').click(function () {
            $("li").filter(".menu").removeClass('activeMenu')
            $(this).addClass('activeMenu')
            console.log($(this).attr('data-title'))
            storage.setItem('menu', $(this).attr('data-title'))
        });
    })

</script>
{/if}
{/*左侧菜单结束*/}
